import { RouteRecordRaw } from 'vue-router'
import Layout from '/@/layouts/index.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/login',
    name: 'Login',
    meta: {
      title: '登录',
      hidden: true,
    },
    component: () => import('/@/views/login/index.vue'),
  },
  {
    path: '/',
    redirect: '/dashboard',
    component: Layout,
    meta: {
      title: '公告板',
      icon: 'HomeOutlined',
      one: true,
    },
    children: [
      {
        path: '/dashboard',
        name: 'Dashboard',
        meta: {
          title: '公告板',
          icon: 'HomeOutlined'
        },
        component: () => import('/@/views/dashboard/index.vue')
      }
    ]
  },
  {
    path: '/doc',
    component: Layout,
    meta: {
      title: '文档',
      icon: 'FilePdfOutlined',
      one: true,
    },
    children: [
      {
        path: '/doc',
        name: 'Doc',
        meta: {
          title: '文档',
          icon: 'FilePdfOutlined'
        },
        component: () => import('/@/views/doc/index.vue')
      }
    ]
  },
  {
    path: '/components',
    component: Layout,
    meta: {
      title: '组件',
      icon: 'AppstoreOutlined'
    },
    children: [
      {
        path: '/components/markdown',
        name: 'Markdown',
        meta: {
          title: 'Markdown',
          icon: 'AppstoreOutlined'
        },
        component: () => import('/@/views/components/markdown/index.vue')
      },
      {
        path: '/components/textEditor',
        meta: {
          title: '富文本 Editor',
          icon: 'CodepenOutlined'
        },
        component: () => import('/@/views/components/textEditor/index.vue')
      },
    ]
  },
  {
    path: '/pages',
    component: Layout,
    meta: {
      title: '页面',
      icon: 'FileTextOutlined'
    },
    children: [
      {
        path: '/pages/office',
        name: 'Office',
        meta: {
          title: 'Office',
          icon: 'GlobalOutlined'
        },
        component: () => import('/@/views/pages/office/index.vue')
      },
      {
        path: '/pages/pdf',
        name: 'PDF',
        meta: {
          title: 'PDF',
          icon: 'FilePdfOutlined'
        },
        component: () => import('/@/views/pages/pdf/index.vue')
      },
    ]
  },
  {
    path: '/error',
    component: Layout,
    name: '错误页',
    meta: {
      icon: 'PieChartOutlined',
      title: '错误页',
    },
    children: [
      {
        path: '/error/404',
        name: '404',
        component: () => import('/@/views/error/404/index.vue'),
        meta: {
          title: '404',
          icon: 'PieChartOutlined',
          isNavActive: true
        }
      },
      {
        path: '/error/403',
        name: '403',
        component: () => import('/@/views/error/403/index.vue'),
        meta: {
          title: '403',
          icon: 'FileOutlined',
          isNavActive: true
        }
      },
    ]
  },
  {
    path: '/:catchAll(.*)',
    component: Layout,
    meta: {
      icon: 'PieChartOutlined',
      title: '错误页',
      hidden: true,
    },
    children: [
      {
        path: '', redirect: '/error/404',
      }
    ]
  },
]

export default routes
